package me.zhengjie.modules.management.rest.admin;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import me.zhengjie.annotation.Log;
import me.zhengjie.modules.management.domain.MrConferenceRoomEquips;
import me.zhengjie.modules.management.domain.Pageable;
import me.zhengjie.modules.management.service.MrConferenceRoomEquipsService;
import me.zhengjie.modules.management.service.dto.MrConferenceRoomEquipsCriteria;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @program: eladmin
 * @description: 培训室设备控制层
 * @author: ming.cao
 * @create: 2020-12-05 15:23
 **/
@RestController
@RequiredArgsConstructor
@Api(tags = "MR:培训室设备管理")
@RequestMapping("/api/conferenceRoomEquips")
public class MrConferenceRoomEquipsController {
    private final MrConferenceRoomEquipsService mrConferenceRoomEquipsService;

    @GetMapping
    @Log("获取培训室设备信息")
    @ApiOperation("获取培训室设备信息")
    public Object getAllList(MrConferenceRoomEquipsCriteria criteria, Pageable pageable){
        return mrConferenceRoomEquipsService.getAllList(criteria ,pageable);
    }

    @PostMapping
    @Log("新增培训室设备信息")
    @ApiOperation("新增培训室设备信息")
    public void addConferenceRoomEquips(@RequestBody MrConferenceRoomEquips mrConferenceRoomEquips){
        mrConferenceRoomEquipsService.addConferenceRoomEquips(mrConferenceRoomEquips);
    }

    @PutMapping
    @Log("修改培训室设备信息")
    @ApiOperation("修改培训室设备信息")
    public void updateConferenceRoomEquips(@RequestBody MrConferenceRoomEquips mrConferenceRoomEquips){
        mrConferenceRoomEquipsService.updateConferenceRoomEquips(mrConferenceRoomEquips);
    }

    @DeleteMapping
    @Log("删除培训室设备信息")
    @ApiOperation("删除培训室设备信息")
    public void delConferenceRoomEquips(@RequestBody List<Integer> ids){
        mrConferenceRoomEquipsService.delConferenceRoomEquips(ids);
    }

    @GetMapping("/getEquipsById")
    @Log("获取id获取培训室设备信息")
    @ApiOperation("获取id获取培训室设备信息")
    public Object getConferencePurposeById(Integer id){
        return mrConferenceRoomEquipsService.getMrConferenceRoomEquipsById(id);
    }

}
